class Solution {
public:
    int mySqrt(int x) 
    {
        if (x==0)
           return 0;
        int c=x;
        double tmp=x;
        int t=20;
        while(t--)
        tmp=0.5*tmp+0.5*c/tmp*1.0;
        return (int)tmp;
 
    }
};
